package easycloud.ecs.common.domain;

import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotNull;

import org.springframework.data.jpa.domain.AbstractPersistable;

@SuppressWarnings("serial")
@MappedSuperclass
public abstract class AbstractHash extends AbstractPersistable<Integer> {

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "providerid")
	private Provider provider;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "itemid")
	private Item item;

	@NotNull
	@Column(name = "hash", nullable = false)
	private String hash;

	public String getHash() {
		return hash;
	}

	public Item getItem() {
		return item;
	}

	public Provider getProvider() {
		return provider;
	}

	public void setHash(String hash) {
		this.hash = hash;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public void setProvider(Provider provider) {
		this.provider = provider;
	}
}
